﻿using System.Collections;

namespace Magellan.Routing
{
    public class RouteValueBag
    {
        private readonly RouteValueDictionary _dictionary;

        public RouteValueBag(IDictionary dictionary)
        {
            _dictionary = new RouteValueDictionary(dictionary);
        }

        public bool IsEmpty
        {
            get { return _dictionary.Count == 0; }
        }

        public object Take(string key)
        {
            if (_dictionary.ContainsKey(key))
            {
                var value = _dictionary[key];
                _dictionary.Remove(key);
                return value;
            }

            return UrlParameter.NotSpecified;
        }
    }
}